import { createRouter, createWebHistory } from 'vue-router'
// import HomeView from '../views/HomeView.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/LoginView.vue')
    },
    {
      path: '/register',
      name: 'register',
      component: () => import('../views/RegisterView.vue')
    },
    {
      path: '/findPsd',
      name: 'findPsd',
      component: () => import('../views/FindPsdView.vue')
    },
    {
      path: '/',
      component: () => import('../layout/Layout.vue'),
      children: [
        { 
          path: '',
          name: 'home',
          component: () => import('../views/HomeView.vue'),
          meta: { title: '首页' }
        },{
          path: '/detect_result',
          name: 'detect_result',
          component: () => import('../views/DetectResultView.vue'),
          meta: { 
            keepAlive: false,  // 明确禁用缓存
            title: '检测结果' 
          }
        }
      ]
    },
  ],
})

export default router
